﻿using System;


namespace MVVM_S.Samples.HelpDesk.Web.Models
{
    public partial class Ticket
    {

        
        /// <summary>
        /// Created Using the slvmprop snippet
        /// </summary>
        string _TicketStatus;

        /// <summary>
        /// Read-Only Status of the Ticket
        /// </summary>
        public string TicketStatus
        {
            get { return _TicketStatus; }
            private set         // Changed to Private to keep View from trying to update this
            {
                if (_TicketStatus != value)
                {
                    _TicketStatus = value;
                    RaisePropertyChanged("TicketStatus");
                }
            }
        }

        /// <summary>
        /// Set the Client-side property once a ticket is created
        /// </summary>
        partial void OnCreated()
        {
            if (Resolved.HasValue)
                TicketStatus = "Resolved";
            else
                TicketStatus = "Not Resolved";
        }

        /// <summary>
        /// Update client-side property when the dependent property changes
        /// </summary>
        partial void OnResolvedChanged()
        {
            if (Resolved.HasValue)
                TicketStatus = "Resolved";
            else
                TicketStatus = "Not Resolved";
        }
    }
}
